error in code on GrabCut Foreground Extraction - OpenCV with Python for Image and Video Analysis 12
I am getting an error message as :
"line 22, in <module>
img= img * mask2[:,:,np.newaxis]
ValueError: operands could not be broadcast together with shapes (281,500,3) (281,500,1,3) "
also could you elaborate on what exactly happens here:
cv2.grabCut(img,mask,rect,bgdModel,fgdModel,5,cv2.GC_INIT_WITH_RECT)
mask2 = np.where((mask==2)|(mask==0),0,1).astype('uint8')
img = img*mask2[:,:,np.newaxis]
You must be logged in to post. Please login or register an account.